﻿NChildbirth = {
	MIN_REPRODUCTION_AGE_IN_HISTORY_DB = 12 # If a historical parent is younger than this when their child is born, we log an error
	MIN_FEMALE_REPRODUCTION_AGE = 16
	MAX_FEMALE_REPRODUCTION_AGE = 45
	MIN_MALE_REPRODUCTION_AGE = 16
	BASE_NR_OF_CHILDREN_PER_COUPLE = { 1 1 2 3 5 5 } # Based on tier of character or parents; whichever is higher Unlanded, Baron, Count, ..., Emperor
	CHANCE_OF_LOWERED_CHILD_LIMIT = 0.5	# Chance that the child limit is lowered by 1
	EXTRA_CHILDREN_FOR_RULERS = 2 # If either character is a ruler, they get extra children
	CHARACTER_IN_POOL_CHILD_LIMIT = -1	# If in the pool, child limit is modified by this
	CHILD_BIRTH_TO_PREGNANCY_WAIT = 3
	MALE_FERTILITY_MULTIPLIER_LIMITS = { 70 60 50 40 35 } # Ages where fertility multiplier is applied 25 means up to 25, needs to be sorted in descending order
	MALE_FERTILITY_MULTIPLIER = { 0.5 0.6 0.7 0.8 0.9 1.0 } # Multiplier values based on age limits from FERTILITY_MULTIPLIER_LIMITS should have an extra value at the beginning for characters older than first limit
	FEMALE_FERTILITY_MULTIPLIER_LIMITS = { 45 40 35 30 25 } # Ages where fertility multiplier is applied 25 means up to 25, needs to be sorted in descending order
	FEMALE_FERTILITY_MULTIPLIER = { 0.1 0.33 0.5 0.7 0.9 1.0 } # Multiplier values based on age limits from FERTILITY_MULTIPLIER_LIMITS should have an extra value at the beginning for characters older than first limit
	MOTHER_FERTILITY_REDUCTION_PER_PREVIOUS_CHILD = 0.05
	LOW_FERTILITY = 0.1
	PRIMARY_SPOUSE_FERTILITY_MULTIPLIER = 1
	SECONDARY_SPOUSE_FERTILITY_MULTIPLIER = 0.5
	CONCUBINE_FERTILITY_MULTIPLIER = 0.5
	NOT_SPOUSE_FERTILITY_MULTIPLIER = 1
	NON_RULER_FERTILITY_MULTIPLIER = 0.85	# If neither parent is a ruler, resulting fertility gets multiplied by this
	FERTILITY_CHANCE_MULTIPLIER = 4.75 # Fertility is an average between the father and the mother (if the mother has 0.3 and the father 0.5, the average is 0.4), this number is then multiplied by this multiplier to produce the percentage chance of impregnation. Impregnation is checked every month.
	MIN_FERTILITY_CHANCE = 1
	MAX_FERTILITY_CHANCE = 25
	TWIN_BASE_CHANCE = 0.02
	TWIN_BONUS_MAX_AGE = 35
	TWIN_BONUS_MIN_AGE = 25
	TWIN_BONUS_CHANCE = 0.02
	TWIN_MOTHER_HAD_TWINS_BONUS = 0.05
	TWIN_GRANDMOTHER_HAD_TWINS_BONUS = 0.03
	IDENTICAL_TWIN_CHANCE = 0.013
	PREGNANCY_DAYS = 280
	DAYS_TO_PREGNANCY_REVEAL = 60
	FEMALE_CHANCE = 49
	NEWBORN_HEALTH_BASE = 4.5
	NEWBORN_HEALTH_SPAN = 0.5
	NEWBORN_HEALTH_FEMALE_BONUS = 0.5
	INHERIT_RECESSIVE_GENE_CHANCE = 0.25	# Probability of a recessive gene being picked as a child's dominant/recessive gene. Only used for portraits

	# Note that the recessive chance is checked only if inheriting it outright fails
	# Chances are in %. Values above 100% work and can make sense if there's modifiers that might reduce the chance
	ACTIVE_TRAIT_CHANCE_ACTIVE_ACTIVE = 80			# Chance of outright inheriting a genetic trait if both parents have it
	ACTIVE_TRAIT_CHANCE_ACTIVE_INACTIVE = 50		# Chance of outright inheriting a genetic trait if one parent has it, and one is carrying it recessively
	ACTIVE_TRAIT_CHANCE_ACTIVE_NONE = 25			# Chance of outright inheriting a genetic trait if one parent has it
	ACTIVE_TRAIT_CHANCE_INACTIVE_INACTIVE = 10		# Chance of outright inheriting a genetic trait if both parents are carrying it
	ACTIVE_TRAIT_CHANCE_INACTIVE_NONE = 2			# Chance of outright inheriting a genetic trait if one parent is carrying it
	INACTIVE_TRAIT_CHANCE_ACTIVE_ACTIVE = 150		# Chance of recessively inheriting a genetic trait if both parents have it. Deliberately over 100% so even if it is a bad trait, the modifiers to inheritance won't let you avoid it
	INACTIVE_TRAIT_CHANCE_ACTIVE_INACTIVE = 100		# Chance of recessively inheriting a genetic trait if one parent has it, and one is carrying it recessively
	INACTIVE_TRAIT_CHANCE_ACTIVE_NONE = 75				# Chance of recessively inheriting a genetic trait if one parent has it
	INACTIVE_TRAIT_CHANCE_INACTIVE_INACTIVE = 50	# Chance of recessively inheriting a genetic trait if both parents are carrying it
	INACTIVE_TRAIT_CHANCE_INACTIVE_NONE = 25		# Chance of recessively inheriting a genetic trait if one parent is carrying it

	# General logic for tiered trait inheritance:
	# 1. Start from highest trait
	# 2. Calc active chance. Lower tiers ( including inactive ) count as inactive of the tier. Each level down beyond the first multiplies chance by a define
	# 3. If active, use it; DONE
	# 4. Otherwise, go down a tier, if inactive pretend 1 more parent has that tier active, otherwise 1 more parent has it inactive.GOTO 2
	MATCHED_TRAIT_DIFFERENCE_MULT = 0.2				# When trying to inherit a tiered genetic trait, and the other person has one of lower tier, we pretend that means they've  got the higher tier one recessively, and reduce the chance of inheritance by this much per tier further down than 1 the other parent's trait is
	TIER_TRAIT_REDUCTION_MULT = 0.4					# When going down a tier, add this chance
	
	FERTILITY_LEVELS = {
		0.0
		0.2
		0.6
		0.8 }	# The thresholds for each fertility level
		
	INBREEDING_ANCESTOR_GENERATIONS = 4						# How many generations are checked for common ancestors of the both parents (including the parents) for the purposes of getting the inbreeding trait and the pure-blooded trait
	INBRED_CHANCE_ANCESTOR_COUNT_LEVELS = { 15 17 20 22 }	# Numbers of common ancestors defining different level of inbreeding chance (one extra level above the max value)
	INBRED_CHANCE_FACTOR_LEVELS = { 0.33 0.75 1 2 3 }		# Inbreeding chance factors for different level. The final chance in percent is given by the number of common ancestors X corresponding level factor X inbreeding chance modifier
	PUREBLOODED_CHANCE_ANCESTOR_COUNT_LEVELS = { 20 22 }	# Same as INBRED_CHANCE_ANCESTOR_COUNT_LEVELS, but for the "pure-blooded" trait.
	PUREBLOODED_CHANCE_FACTOR_LEVELS = { 0 0.15 0.3 }		# Same as INBRED_CHANCE_FACTOR_LEVELS, but for the "pure-blooded" trait.
	TRAIT_REINFORCEMENT_CHANCE = 0.5						# The chance that a trait that gets inherited from both parents will get reinforced to a higher level.

	EXTRA_CHILDREN_FOR_PLAYERS = 9999 # Num of extra children players can have before reaching living child limit
	EXTRA_CHILDREN_PER_EXTRA_SPOUSE = 2 # Num of extra children per spouse above one before reaching living child limit
	EXTRA_CHILDREN_PER_EXTRA_CONCUBINE = 2 # Num of extra children per concubine above one before reaching living child limit
	EXTRA_FERTILITY_FOR_FIRST_CHILD = 0.0 # Extra fertility if the couple are primary spouses and have no children together
	EXTRA_FERTILITY_FOR_FIRST_RULER_CHILD = 0.3 # Extra fertility if the couple are primary spouses and have no children together, and at least one of them is a ruler
	DIVINE_MARRIAGE_FERTILITY_MULTIPLIER = 1 # Multiplier if the couple is close or extended family and their faith allows divine marriage
	CLOSE_FAMILY_FERTILITY_MULTIPLIER = 0.9 # Multiplier if the couple is close family and their faith does not allow divine marriage
	EXTENDED_FAMILY_FERTILITY_MULTIPLIER = 1 # Multiplier if the couple is extended family and their faith does not allow divine marriage
	FERTILITY_IN_POOL_MULTIPLIER = 0.25	# Characters in the pool will have their fertility multiplied by this
}